home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
pcdone
/
pcdone.doc
< prev
Wrap
Text File
|
1994-08-11
|
6KB
|
157 lines
* Pcdone.DLL (C) 1994, Paul Lee / Abri Technologies, Inc.
If this is your demo version of PCdone, please see the licence.doc file
for further information.
LEGAL STUFF:
Author disclaims any liabilities for use of PCdone or fitness or
suitability for any purpose.
Author contact info is at end of this doc.
PURPOSE:
The pcdone() function displays a percentage progress bar window while
a task is working.
Often, a client has to sit and wait for a longer task to finish while
nothing is happening on screen and may wonder whether the computer has
locked up. You have frequently seen the % progress bars on software
installation programs and other places.
Here is a handy, universal, easy-to-use program which you can include in
your VisualBasic and other windows applications if they can access DLL's.
You can use it during long printing procedures, large calculations,
scanning through long databases, SQL's. etc.
HOW TO USE IT IN VisualBasic:
Copy pcdone.dll file to the working directory of your program.
In a module or form declaration section include the following statement
all in one line.
Declare Function PCdone Lib "pcdone.dll" (ByVal hWnd As Integer,
ByVal Percent As Integer, ByVal Title As String) As Integer
Then afterwards you can simply use it with the statement
SomeIntVar = PCdone(Form.hWnd, Percent, YourMessageHere)
Where: SomeIntVar is an integer variable,
Percent is the percentage bar length you want to display, and
YourMessageHere is a string of characters that you want to
display on top of the percentage bar.
Example: kkk = PCdone(Form2.hWnd, 34, "Working Please Wait......")
To end the PCdone window use it with Percent value greater than 100.
IMPORTANT NOTE: Make sure you select the topmost visible/existing form
for the Form.Hwnd argument. Otherwise the PCdone window may actually be
hiding behind the form or not initialize properly. PCdone does not have
to be called from the topmost form, only related to it in "Form.hWnd".
Example VisualBasic Program Syntax:
===================================
' MODULE1 declaration section
Declare Function PCdone Lib "pcdone.dll" (ByVal hWnd As Integer,
ByVal Percent As Integer, ByVal Title As String) As Integer
' Form1
Sub IDOK_click()
Dim Msg As String, kk As Integer, i as integer, Imax as integer
Msg = "Working. Please wait......"
kk = Pcdone(Form1.hWnd, 0, Msg) 'initial 0 display at beginning.
.
.
kk = Pcdone(Form1.hWnd, 5, Msg) 'a bit further on
.
.
For i = 1 TO Imax
kk = Pcdone(Form1.hWnd, (5 + i/Imax*85), Msg) 'est. 85% for loop.
.
.
.
Next
.
kk = Pcdone(Form1.hWnd, 95, "We're almost there...")
.
kk = Pcdone(Form1.hWnd, 100, "Done")
kk = Pcdone(Form1.hWnd, 200, "") 'to remove the Pcdone window
End Sub
PCdone IN SQL and DATABASE:
It is possible to use pcdone in VisalBasic SQL Select string using
the WHERE clause. Here is a simple example:
"Select Name, Picture from Authors where
PCdone(Form1.hWnd, (5 + i/Imax*85), Msg) > 0 "
A more extensive DATABASE and SQL example discussion is available
in file PCdone.zip in CompuServe FoxForum Library 3.
HOW TO USE IT IN Windows C/C++:
The simplest way to use the PCdone.DLL program is to add its name to
the IMPORTS section of the .DEF file as
.
.
IMPORTS PCDONE.PCdone
.
.
Alternatively you can use the LoadLibrary(), GetProcAddress() and
FreeLibrary() functions to use PCdone.DLL.
The function C syntax is:
int FAR PASCAL PCdone(HWND hWnd, int Percent, LPSTR Title);
RESERVED PCDONE VALUES AND ARGUMENTS:
Special Percent values:
Value Function
> 100 Erase PCdone window and unload it from memory.
-7654 Display licencing information.
Return values of PCdone function:
(value of SomeIntVar)
Value Meaning
0 A system error occured in loading the PCdone window.
1 PCdone window has been initialized successfully.
2 A regular progress-bar/title update was processed.
3 PCdone window has been erased and unloaded from memory.
4 Licencing information has been requested/processed.
Other:
Eratic progress bar activity - disappearance, etc. It means that your
percentages are not increasing steadily but going random.
OPTIMIZING for SPEED:
PCdone displays progress for integer values of Percent only.
If a new call to it has the same percent value as the previous value,
PCdone returns without updating its window and thus saves some
CPU time.
--------------------------------------------------------------------------
AUTHOR INFORMATION:
The author is available for VisualBasic/FoxproW/C(DOS/Win)/Pascal/...
programming/consulting.
Professional, well documented software development. Large or small jobs
considered, $25-35/hr, satisfaction guarantee.
CAUTION: The author is over 50, not sexy, charming or verbally impressive -
but does good quality, honest work.
You can contact him
by mail: Paul Lee
Abri Technologies, Inc.
HC 62, Box 100K
Great Cacapon, WV 25422 USA
by E-Mail: 72345.1623@compuserve.com
by phone: (304) 947-7129